package cn.edu.neusoft.yyd208.foodorder.fragment;


import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * A simple {@link Fragment} subclass.
 */
public abstract class BaseFragment extends Fragment {
    protected int layout_file=0;
    //protected int layout_file1=0;
    View view=null;//view1=null;
    abstract void initView();
    abstract void initEvent();
    abstract void initData();
    public int getLayout_file() {
        return layout_file;
    }
    /*public int getLayout_file1() {
        return layout_file1;
    }*/
    public void setLayout_file(int layout_file) {
        this.layout_file = layout_file;
    }
/*public void setLayout_file1(int layout_file1){
    this.layout_file1=layout_file1;
}*/
    public BaseFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view=inflater.inflate(getLayout_file(),container,false);
        //view1=inflater.inflate(getLayout_file1(),container,false);
        initView();
        initEvent();
        initData();
        return view;
    }
    public String getUser_name(){
        SharedPreferences sp;
        sp=getActivity().getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("username","");
    }
    public String getUser_userpass(){
        SharedPreferences sp;
        sp=getActivity().getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("userpass","");

    }
    public String getUser_userid(){
        SharedPreferences sp;
        sp=getActivity().getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("userid","");

    }
}
